﻿// button
(function() {

$(window).data('gui').plugins['button'] =
{

  makeHTML : function(param)
  {
    /*
    options['titlebar-fixe'];
    */

    var obj = document.createElement("input");
	param.parent.appendChild(obj);
	
    var value = param.xml.getAttribute('value');
	if (value === null) param.xml.setAttribute('value','default');
	
    obj.setAttribute('data-effect','button');
	obj.setAttribute('type','button');
	
    return  obj;
  },

  makeXML : function(xml)
  {
		var element = xml.ownerDocument.createElement("button");
		this[0].setAttribute('value',this.value());
		return element;
  },
  
  enable : function(flag)
  {
	if (flag !== undefined && flag !== null)
	{
		if (flag == true || flag == false) this[0].disabled = !flag;
		return this;
	} else {
		return (this[0].disabled == false);
	}
  },
  
  value : function(val)
  {
	if (val !== undefined && val !== null)
	{
		this[0].value = val;
		return this;
	} else {
		return this[0].value;
	}
  },
   
  autofocus : function(flag)
  {
	if (flag !== undefined && flag !== null)
	{
		if (flag == true || flag == false) this[0].autofocus = flag;
		return this;
	} else {
		return this[0].autofocus;
	}
  }
  }
})();